//
//  XDLMMdShowProcess.m
//  xindailianmeng
//
//  Created by 许佳奇 on 17/3/15.
//  Copyright © 2017年 xindailianmeng.cn. All rights reserved.
//

#import "XDLMMdShowProcess.h"

@interface XDLMMdShowProcess ()

@property (nonatomic, strong)UIImageView            *showView;
@property (nonatomic, strong)NSMutableArray         *arrayM;

@end

@implementation XDLMMdShowProcess

-(instancetype)init{
    self = [super init];
    if (self) {
        [self buildLayout];
    }
    return self;
}

- (void)buildLayout{
    self.showView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
}

-(void)showHud{
    
    self.arrayM=[NSMutableArray array];
    for (int i=0; i<8; i++) {
        [self.arrayM addObject:[UIImage imageNamed:[NSString stringWithFormat:@"No_wifi_%d",i + 1]]];
    }
    // 1. 设置图片的数组
    
    [self.showView setAnimationImages:self.arrayM];
    
    // 2. 设置动画时长，默认每秒播放30张图片
    
    [self.showView setAnimationDuration:0.1 * self.arrayM.count];
    
    // 3. 设置动画重复次数，默认为0，无限循环
    
    [self.showView setAnimationRepeatCount:0];
    
    // 4. 开始动画
    
    [self.showView startAnimating];
    
    [[UIApplication sharedApplication].keyWindow addSubview:self.showView];
    
}


-(void)hideHud{
    [self.showView removeFromSuperview];
    [self.arrayM removeAllObjects];
}

@end
